package cn.readjava.bean;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

@Entity
@Table(name = "role_permission", schema = "readjava", catalog = "")
public class RolePermission implements Serializable {
    private long rpId;
    private Long rId;
    private Long pId;

    @Id
    @Column(name = "rp_id", nullable = false)
    public long getRpId() {
        return rpId;
    }

    public void setRpId(long rpId) {
        this.rpId = rpId;
    }

    @Basic
    @Column(name = "r_id", nullable = true)
    public Long getrId() {
        return rId;
    }

    public void setrId(Long rId) {
        this.rId = rId;
    }

    @Basic
    @Column(name = "p_id", nullable = true)
    public Long getpId() {
        return pId;
    }

    public void setpId(Long pId) {
        this.pId = pId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RolePermission that = (RolePermission) o;
        return rpId == that.rpId &&
                Objects.equals(rId, that.rId) &&
                Objects.equals(pId, that.pId);
    }

    @Override
    public int hashCode() {

        return Objects.hash(rpId, rId, pId);
    }
}
